import multiprocessing
import time

from loguru import logger


# 编写代码
def coding():
    for _ in range(3):
        logger.info('coding...')
        time.sleep(1)


# 听音乐
def music():
    for _ in range(3):
        logger.info('music...')
        time.sleep(1)


if __name__ == '__main__':
    # coding()
    # music()

    # 创建子进程并指定执行的任务
    coding_process = multiprocessing.Process(target=coding)
    music_process = multiprocessing.Process(target=music)

    # 启动进程执行任务
    coding_process.start()
    music_process.start()
